﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.Core.EntityModel.Prototype;
using YasharEl.Infrastructure.Core.Commenting;
using YasharEl.Infrastructure.Core.Prototype;
using YasharEl.Infrastructure.ProcessEngine.EntityModel.Prototype;

namespace YasharEl.Infrastructure.ProcessEngine.EntityModel
{
    public class ProcessEntity : AbstractPrototypeEntity, IProcess
    {
        #region Entity Overrides

        public override long Id
        {
            get
            {
                return ProcessId;
            }
            protected set
            {
                ProcessId = value;
            }
        }

        #endregion

        #region IProcess Members

        public virtual long ProcessId
        {
            get;
            set;
        }

        public virtual DateTime CreatedDate
        {
            get;
            set;
        }

        public virtual IProcessParticipant CreatedBy
        {
            get;
            set;
        }

        public virtual IProcessParticipant Owner
        {
            get;
            set;
        }

        public virtual DateTime? ModifiedDate
        {
            get;
            set;
        }

        public virtual IProcessParticipant ModifiedBy
        {
            get;
            set;
        }

        public virtual DateTime? StartedDate
        {
            get;
            set;
        }

        public virtual DateTime ExpiredDate
        {
            get;
            set;
        }

        public virtual DateTime? ClosedDate
        {
            get;
            set;
        }

        public virtual IProcessParticipant ClosedBy
        {
            get;
            set;
        }

        public virtual Guid WorkflowInstanceId
        {
            get;
            set;
        }

        public virtual IProcessDefinition ProcessDefinition
        {
            get;
            set;
        }

        public virtual ProcessStatus ProcessStatus
        {
            get;
            set;
        }

        public virtual ProcessPriority ProcessPriority
        {
            get;
            set;
        }

        #endregion

        #region ICommentable Members

        public virtual IComment AddComment(string comment)
        {
            throw new NotImplementedException();
        }

        public virtual IList<IComment> Comments
        {
            get;
            set;
        }

        #endregion

        #region AbstractPrototypeEntity Overrides

        protected override IHasPropertyDefinitions MappingsContainer
        {
            get
            {
                return ProcessDefinition;
            }
        }

        protected override AbstractPropertyInstanceEntity CreatePropertyInstanceEntity()
        {
            return new ProcessPropertyInstanceEntity();
        }

        #endregion
    }
}
